package org.lzy.shop.adapter

import android.content.Context
import android.graphics.Color

import android.view.ViewGroup

import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import org.lzy.shop.R
import org.lzy.shop.response.Item0


class LogisticsListAdapter() : BaseQuickAdapter<Item0, QuickViewHolder>() {

    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: Item0?) {
        item?.let {
            if (holder.layoutPosition == 0) {
                //第一行开始
                holder.setVisible(R.id.tvTopLine, false)
                holder.setText(R.id.time, item.time)
                holder.setText(R.id.status, item.status)
                holder.setTextColor(R.id.status, Color.BLACK)
                holder.setTextColor(R.id.time, Color.GRAY)

            } else {
                //第二行开始
                holder.setText(R.id.time, item.time)
                holder.setText(R.id.status, item.status)
                holder.setTextColor(R.id.status, Color.GRAY)
                holder.setTextColor(R.id.time, Color.GRAY)
            }

        }
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.item_logistics, parent)
    }
}
